<template>
  <div class="detail-wrapper">
    <div class="detail-main">
      <div class="detail-column">
        <div class="column-title">个人信息</div>
        <div class="column-content">
          <a-descriptions
            bordered
            :labelStyle="{ width: '120px' }"
            :contentStyle="{ width: '500px' }"
            :column="{ xxl: 2, xl: 2, lg: 2, md: 1, sm: 1, xs: 1 }"
          >
            <a-descriptions-item label="姓名">{{
              datas?.user?.real_name
            }}</a-descriptions-item>
            <a-descriptions-item label="账号">
              {{ datas?.user?.login_name }}
            </a-descriptions-item>
          </a-descriptions>
        </div>
      </div>
      <div class="detail-column">
        <div class="column-title">班级信息</div>
        <div class="column-content">
          <a-descriptions
            bordered
            :labelStyle="{ width: '120px' }"
            :contentStyle="{ width: '500px' }"
            :column="{ xxl: 2, xl: 2, lg: 2, md: 1, sm: 1, xs: 1 }"
          >
            <a-descriptions-item
              label="邀请老师"
              :span="{ xxl: 2, xl: 2, lg: 2, md: 1, sm: 1, xs: 1 }"
              >{{ datas?.invite_teach_user_real_name }}</a-descriptions-item
            >
            <template
              v-if="
                datas?.class_student_list &&
                datas?.class_student_list.length > 0
              "
            >
              <template
                v-for="(item, index) in datas?.class_student_list"
                :key="index"
              >
                <a-descriptions-item label="班级名称">{{
                  item?.clazz?.name
                }}</a-descriptions-item>
                <a-descriptions-item label="教师">{{
                  item?.clazz.teacher_name
                }}</a-descriptions-item>
              </template></template
            >
          </a-descriptions>
        </div>
      </div>
    </div>
  </div>
</template>
<script setup>
import { ref, computed, onMounted } from "vue";
import { useRoute } from "vue-router";
import api from "@/api";
const route = useRoute();
const query = computed(() => route.query);
const datas = ref();
const getData = async () => {
  let params = {
    student_id: query.value.id,
  };
  const res = await api.apiStudentFetchModelPost(params);
  datas.value = res.data;
};
onMounted(async () => {
  await getData();
});
</script>
